WEIBULL_MIN

Overview

The WEIBULL_MIN function computes various statistical measures of the Weibull minimum distribution, one of the most widely used probability distributions in reliability engineering, survival analysis, and extreme value theory. Named after Swedish mathematician Waloddi Weibull, who formalized it in 1951, this distribution models the time-to-failure of systems and components, as well as phenomena such as wind speed distributions and material strength. For implementation details, see the SciPy documentation.

The Weibull minimum distribution arises from the Fisher-Tippett-Gnedenko theorem in extreme value theory as the limiting distribution of the rescaled minimum of independent and identically distributed random variables. The probability density function (PDF) is defined as:

f(x, c) = c x^{c-1} \exp(-x^c)

for x > 0 and shape parameter c > 0. With location (\text{loc}) and scale (\lambda) parameters, the general form becomes:

f(x, c, \text{loc}, \lambda) = \frac{c}{\lambda} \left(\frac{x - \text{loc}}{\lambda}\right)^{c-1} \exp\left(-\left(\frac{x - \text{loc}}{\lambda}\right)^c\right)

The cumulative distribution function (CDF) is given by:

F(x, c, \lambda) = 1 - \exp\left(-\left(\frac{x}{\lambda}\right)^c\right)

The shape parameter c determines the failure rate behavior and has important interpretations: when c < 1, the failure rate decreases over time (useful for modeling “infant mortality” in components); when c = 1, the distribution reduces to the exponential distribution with constant failure rate; and when c > 1, the failure rate increases over time (modeling wear-out failures). At c = 2, the distribution becomes a Rayleigh distribution.

Common applications include reliability engineering for predicting component lifetimes, wind energy analysis for modeling wind speed distributions, survival analysis in medical research, and material science for characterizing strength distributions (where the shape parameter is known as the Weibull modulus). For more theoretical background, see the Wikipedia article on Weibull distribution.

This example function is provided as-is without any representation of accuracy.

Excel Usage

=WEIBULL_MIN(value, c, loc, scale, weibull_min_method)
  • value (float, optional, default: null): Input value x for pdf/cdf/sf, or probability q for icdf/isf (0-1). Not required for mean/median/var/std.
  • c (float, optional, default: 1): Shape parameter (must be > 0).
  • loc (float, optional, default: 0): Location parameter.
  • scale (float, optional, default: 1): Scale parameter (must be > 0).
  • weibull_min_method (str, optional, default: “pdf”): Method to compute.

Returns (float): Result of the requested method, or str error message if input is invalid.

Examples

Example 1: PDF at x=2

Inputs:

value c loc scale weibull_min_method
2 1.5 0 1 pdf

Excel formula:

=WEIBULL_MIN(2, 1.5, 0, 1, "pdf")

Expected output:

0.1254

Example 2: CDF at x=2

Inputs:

value c loc scale weibull_min_method
2 1.5 0 1 cdf

Excel formula:

=WEIBULL_MIN(2, 1.5, 0, 1, "cdf")

Expected output:

0.9409

Example 3: Inverse CDF at q=0.940894

Inputs:

value c loc scale weibull_min_method
0.940894 1.5 0 1 icdf

Excel formula:

=WEIBULL_MIN(0.940894, 1.5, 0, 1, "icdf")

Expected output:

2

Example 4: Mean of distribution

Inputs:

c loc scale weibull_min_method
1.5 0 1 mean

Excel formula:

=WEIBULL_MIN(1.5, 0, 1, "mean")

Expected output:

0.9027

Python Code

from scipy.stats import weibull_min as scipy_weibull_min
import math

def weibull_min(value=None, c=1, loc=0, scale=1, weibull_min_method='pdf'):
    """
    Compute various functions of the Weibull minimum distribution using scipy.stats.weibull_min.

    See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.weibull_min.html

    This example function is provided as-is without any representation of accuracy.

    Args:
        value (float, optional): Input value x for pdf/cdf/sf, or probability q for icdf/isf (0-1). Not required for mean/median/var/std. Default is None.
        c (float, optional): Shape parameter (must be > 0). Default is 1.
        loc (float, optional): Location parameter. Default is 0.
        scale (float, optional): Scale parameter (must be > 0). Default is 1.
        weibull_min_method (str, optional): Method to compute. Valid options: PDF, CDF, ICDF, SF, ISF, Mean, Median, Variance, Std Dev. Default is 'pdf'.

    Returns:
        float: Result of the requested method, or str error message if input is invalid.
    """
    valid_methods = {'pdf', 'cdf', 'icdf', 'sf', 'isf', 'mean', 'median', 'var', 'std'}
    if not isinstance(weibull_min_method, str):
        return f"Invalid method: {weibull_min_method}. Must be a string."

    weibull_min_method = weibull_min_method.lower()
    if weibull_min_method not in valid_methods:
        return f"Invalid method: {weibull_min_method}. Must be one of {', '.join(sorted(valid_methods))}."

    try:
        c = float(c)
        loc = float(loc)
        scale = float(scale)
    except (ValueError, TypeError):
        return "Invalid input: c, loc, and scale must be numbers."

    if c <= 0:
        return "Invalid input: c must be > 0."
    if scale <= 0:
        return "Invalid input: scale must be > 0."

    # Methods that require value
    if weibull_min_method in {'pdf', 'cdf', 'icdf', 'sf', 'isf'}:
        if value is None:
            return f"Invalid input: missing required argument 'value' for method '{weibull_min_method}'."
        try:
            value = float(value)
        except (ValueError, TypeError):
            return "Invalid input: value must be a number."

        if weibull_min_method in {'icdf', 'isf'} and not (0 <= value <= 1):
            return f"Invalid input: value (probability) must be between 0 and 1 for {weibull_min_method}."

    try:
        dist = scipy_weibull_min(c, loc=loc, scale=scale)

        if weibull_min_method == 'pdf':
            result = dist.pdf(value)
        elif weibull_min_method == 'cdf':
            result = dist.cdf(value)
        elif weibull_min_method == 'sf':
            result = dist.sf(value)
        elif weibull_min_method == 'icdf':
            result = dist.ppf(value)
        elif weibull_min_method == 'isf':
            result = dist.isf(value)
        elif weibull_min_method == 'mean':
            result = dist.mean()
        elif weibull_min_method == 'median':
            result = dist.median()
        elif weibull_min_method == 'var':
            result = dist.var()
        elif weibull_min_method == 'std':
            result = dist.std()
    except Exception as e:
        return f"scipy.stats.weibull_min error: {e}"

    if isinstance(result, (float, int)) or hasattr(result, 'item'):
        result = float(result)
        if math.isnan(result):
            return "Result is NaN (not a number)"
        if math.isinf(result):
            return "inf" if result > 0 else "-inf"
        return result

    return float(result)

Online Calculator